package com.xf.common.core.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;
import java.util.Date;

/**
 * @author xufeng
 */
@Data
@SuppressWarnings("all")
@EqualsAndHashCode(callSuper = true)
public class FebsAuthUser extends User {

    private Long userId;
    /**
     * 租户id（组织id）
     */
    private Long tenantId;

    /**
     * 组织名称
     */
    private String organizationId;

    /**
     * 用户编码
     */
    private String userCode;

    /**
     * 密码
     */
    private String password;

    /**
     * 手机
     */
    private String telPhone;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 昵称
     */
    private String alias;

    /**
     * 最后登录时间
     */
    private Date loginTime;

    /**
     * 是否管理员
     */
    private Boolean isAdmin = false;

    /**
     * 部门名称
     */
    private String departmentName;

    /**
     * 职位名称
     */
    private String positionName;

    /**
     * 是否认证平台管理员
     */
    private Boolean isGlobalAdmin = false;

    /**
     * 登录app
     */
    private String signupApplication;

    /**
     * 上次登录时间
     */
    private String lastSigninTime;

    /**
     * ip地址
     */
    private String lastSigninIp;

    /**
     * 状态(0:正常；1:停用)
     */
    private Boolean state;
    /**
     * 认证方式
     */
    private String authenticationMethod;


    public FebsAuthUser(String username, String password, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
    }

    public FebsAuthUser(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
    }


    public Long getTenantId() {
        return tenantId;
    }

    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }
}
